package structure.set.test;

import structure.set.basic.list.MyListSet;
import structure.set.basic.list.MySet1;
import structure.set.basic.tree.MyTreeSet;

/**
 * 项目名称: god
 * 包 名 称: com.set
 * 类 名 称: Main
 * 类 描 述: TODO
 * 创建时间: 2020/6/14 3:37 下午
 * 创 建 人: Justice
 */
public class Main {
    public static void main(String[] args) {
        test2();
    }

    private static void test() {
        MyListSet<Integer> myListSet = new MyListSet<Integer>();
        myListSet.add(1);
        myListSet.add(2);
        myListSet.add(1);
        myListSet.traversal(new MySet1.Visitor<Integer>() {
            @Override
            public boolean visit(Integer element) {
                System.out.println(element);
                return false;
            }
        });
    }

    private static void test2(){
        // 元素必须具备可比较性
        MyTreeSet<Integer> myTreeSet = new MyTreeSet<Integer>();
        myTreeSet.add(10);
        myTreeSet.add(20);
        myTreeSet.add(20);
        myTreeSet.add(1);
        myTreeSet.traversal();
    }
}
